package com.grgbanking.it.project.entity;

import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.grgbanking.it.common.formatter.annotation.TimestampFormat;

/**
 * 任务
 * 
 * Task
 * 
 * @author 潘广伟
 * @Email p_3er@qq.com
 * @Date 2015-1-28 下午2:53:08
 * 
 * @version 1.0.0
 *
 */
@Entity
@Table(name = "task_result", catalog = "it_system")
public class TaskResult implements java.io.Serializable {
	private Integer id;
	private Task task;
	private Timestamp finishTime;
	private Integer duration;
	private String result;
	
	/*
	 * 以下字段用于数据传输
	 */
	@TimestampFormat
	private Timestamp end;
	
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	@Column(name = "result", length = 65535)
	public String getResult() {
		return this.result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	
	@Column(name = "duration")
	public Integer getDuration() {
		return this.duration;
	}

	public void setDuration(Integer duration) {
		this.duration = duration;
	}


	@Column(name = "finishTime")
	public Timestamp getFinishTime() {
		return finishTime;
	}

	public void setFinishTime(Timestamp finishTime) {
		this.finishTime = finishTime;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "task_id")  
	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	@Transient
	public Timestamp getEnd() {
		return end;
	}

	public void setEnd(Timestamp end) {
		this.end = end;
	}
	
	
}